/*
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see <http://www.gnu.org/licenses/>.
 */

package usercommands;

import gameserver.model.events.battlegrounds.factories.SurveyFactory;
import gameserver.model.gameobjects.player.Player;
import gameserver.services.HTMLService;
import gameserver.utils.PacketSendUtility;
import gameserver.utils.chathandlers.UserCommand;

public class ArenaTeam extends UserCommand
{
	public ArenaTeam ()
	{
		super("arena");
	}
	
	@Override
	public void executeCommand(Player player, String params)
	{
		if(player == null)
			return;
		
		if(player.getBattleGround() != null)
		{
			PacketSendUtility.sendMessage(player, "You are already in a battleground.");
			PacketSendUtility.sendMessage(player, "Use your spell Return to leave the battleground.");
			return;
		}
		else if(player.battlegroundWaiting)
		{
			PacketSendUtility.sendMessage(player, "You are already registered in a battleground.");
			PacketSendUtility.sendMessage(player, "Use the command /bg unregister to cancel your registration.");
			return;
		}
		else
			HTMLService.showHTML(player, SurveyFactory.getArenaManagementMenu(player), 142000001);
	}
}
